<?
define('SITE_AREA', 'library');
include('includes/appInit.php');
include('includes/ajax/sysData.php');
include('includes/ajax/ajaxLibrary.php');

$jsFile = 'jsLibrary.js|jsLibraryInit.js';
$editor = 1;
$tags   = 1;   
$libraryCategories = getCategories('Library');
$libraryFormats    = getCategories('LibraryFormat','select','main',null,793);
$tagString         = getTags('Library');
include('includes/header.php');
?>
<div id="content0" style="padding: 10px; width: 100%;" class="x-layout-inactive-content">
		<input type="hidden" id="libraryLogStart" />
		<div id="messageSearch" style="display: none;"></div>
						
		<h1 id="librarySearchTitle">Search the library</h1>		
				
		<div id="formAdvancedSearch" class="blueBox" style="display: none; width: 95%;">
			<p><label class="vertLabelSmall">Keyword (searches Title, Abstract, Authors, Publisher, Tags)</label>
			<input type="text" style="width: 400px;" tabindex="1" id="sKeyword" onKeyPress="if(enterPressed(event)){ librarySearchObj.advancedLibrarySearch(); }" /></p>
			
			<p><label class="vertLabelSmall">ISBN Number</label>
			<input type="text" style="width: 400px;" tabindex="2" id="sISBN" onKeyPress="if(enterPressed(event)){ librarySearchObj.advancedLibrarySearch(); }" /></p>
			
			<p><label class="vertLabelSmall">Category</label>
				<select id="sCat" size="1" tabindex="3" style="width: 400px;">
				<option>Select...</option>
				<?=$libraryCategories; ?>
				</select>
			</p>
			
			<div style="float: left; margin-left: 5px; margin-right: 5px;">
				<a href="#" class="coolButton buttonBGBlueGray" onClick="librarySearchObj.advancedLibrarySearch(); return false;" tabindex="4"><span class="search">Search</span></a>
			</div>
			<div style="float: left;">
				<a href="#" class="coolButton buttonBGRed" onClick="librarySupportObj.toggleAdvancedSearchForm(); return false;" tabindex="5"><span class="cancel">Cancel</span></a>
			</div>
			<div style="clear: left;"></div>
		</div>	
		
		<div id="formSimpleSearch">
			<div style="float: left">
				<input type="text" class="bigFormText" id="librarySearchBox" value="Quick search (title only)" onFocus="this.value='';" style="width: 400px; height: 27px;" />
			</div>
			<div style="float: left; margin-left: 10px;">
				<a href="#" class="coolButton buttonBGBlueGray" onClick="searchContactsObj.toggleAdvancedSearchForm(); return false;"><span class="search">Search</span></a>
			</div>
			<div style="clear: left;"></div>
			<p><a href="#" onClick="librarySupportObj.toggleAdvancedSearchForm(); return false;"><b>Advanced search</b></a></p>
		</div>
		
		<div style="width: 95%; margin-top: 10px;" id="libraryAdvancedSearchContainer"></div>		
</div>  

<div id="content1" style="padding: 10px;" class="x-layout-inactive-content">
		<h1 id="libraryUpdateTitle" style="float: left;">Add new library item</h1>
		<div id="statusDiv" style="float: left; height: 30px;"></div>
		<div style="clear: left; height: 5px;"></div>
		
		<div id="formAddEditItem" class="blueBox">
			<form>
			<input type="hidden" id="formAction" value="add" />
			<input type="hidden" id="libraryID" />
			
			<p class="ieVanishHack"><label class="vertLabelSmall">Select a library category</label>
				<select id="lCat" size="1" tabindex="6" style="width: 500px;">
				<option>Select...</option>
				<option></option>
				<?=$libraryCategories; ?>
				</select>
			</p>
			
			<p class="ieVanishHack"><label class="vertLabelSmall">ISBN Number</label>
			<input type="text" style="width: 500px;" id="lISBN" tabindex="7" /></p>
			
			<p class="ieVanishHack"><label class="vertLabelSmall">Title</label>
			<input type="text" style="width: 500px;" id="lTitle" tabindex="8" /></p>
						
			<p class="ieVanishHack"><label class="vertLabelSmall">Authors</label>
			<input type="text" style="width: 500px;" id="lAuthors" tabindex="9" /></p>
			
			<p class="ieVanishHack"><label class="vertLabelSmall">Abstract</label>
				<textarea name="lAbstract" tabindex="10" id="lAbstract" class="editorSimple" style="width: 500px; height: 150px;"></textarea>
			</p>
			
			<p class="ieVanishHack"><label class="vertLabelSmall">Publisher</label>
			<input type="text" style="width: 500px;" id="lPublisher" tabindex="11" /></p>
				
			<p class="ieVanishHack"><label class="vertLabelSmall">Item Format</label>
				<select id="lFormat" size="1" style="width: 500px;" tabindex="12">
				<?=$libraryFormats; ?>
				</select>
			</p>
			
			<p><label class="vertLabelSmall">Item Tags</label>
				<textarea id="tags" tabindex="13" style="width: 500px; height: 50px;"></textarea>
				<div class="tagDiv" style="margin-left: 7px;"><?=$tagString; ?></div>
			</p>	
			
			<p style="margin-top: 5px;" class="ieVanishHack"><input type="checkbox" tabindex="13" id="lInHouseOnly" value="1" />
				<b>In-house viewing only.</b></p>
				
			<p style="margin-bottom: 10px;" class="ieVanishHack"><label class="vertLabelSmall">Available languages</label>
                    <input type="checkbox" id="lLangEnglish" value="1" tabindex="14" checked /> <span class="labelSmall">English</span>
				<input type="checkbox" id="lLangSpanish" value="1" tabindex="15" /> <span class="labelSmall">Spanish</span>
				<input type="checkbox" id="lLangRussian" value="1" tabindex="16" /> <span class="labelSmall">Russian</span>
               </p>	
				
			<div style="float: left; margin-left: 5px; margin-right: 5px;">
				<a href="#" class="coolButton buttonBGBlueGray" tabindex="17" onClick="libraryUpdateObj.saveLibraryItem(); return false;"><span class="save">Save</span></a>
			</div>
			<div style="float: left;">
				<a href="#" class="coolButton buttonBGYellow" tabindex="18" onClick="librarySupportObj.clearAddEditForm(); return false;"><span class="update">Clear</span></a>
			</div>
               <div style="float: left; margin-left: 10px; margin-top: 5px;" id="messageLibrarySave"></div>
			<div style="clear: left;"></div>
			</form>
		</div>	
		
		<div style="margin-top: 20px;" id="libraryListNewItems"></div>
</div>

<div id="content2" style="padding: 10px;" class="x-layout-inactive-content">
	<h1 id="libraryCheckoutTitle" style="float: left;">Library items currently checked out</h1>
	<div id="statusDiv" style="float: left; height: 30px;"></div>
	<div style="clear: left; height: 5px;"></div>
	
	<div id="libraryListCheckedOut"></div>
</div>
<div id="south"></div>  
<? include('includes/footer.php'); ?>